{extend name="template/base" /}
{block name="content"}
<div class="page-container">
    {include file='form' /}
    <div class="cl pd-5 bg-1 bk-gray">
        <span class="l">
            {tp:menu /}
        </span>
        <span class="r pt-5 pr-5">
            共有数据 ：<strong>{$count}</strong> 条
        </span>
    </div>
    <table class="table table-border table-bordered table-hover table-bg mt-20">
        <thead>
        <tr class="text-c">
            {include file="th" /}
            <th width="70">操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="list" id="vo"}
        <tr class="text-c">
            {include file="td" /}
            <td class="f-14">
                {$vo.status|show_status=$vo.id}
                {tp:menu menu='sedit,sdelete,user,access' url=',,user:id=$vo.id,access:id=$vo.id' title=',,用户列表,授权' /}
                {if $info['suspend_order']}
                    {if (in_array($vo['id'],$info['suspend_order']))}
                    <a href="javascript:;" onclick="cancel_suspended({$vo.id},'suspend_order')" class="label label-warning radius" title="取消中止订单提示">取消中止订单提示</a>
                    {else /}
                    <a href="javascript:;" onclick="add_suspended({$vo.id},'suspend_order')" class="label label-warning radius" title="分配中止订单提示">分配中止订单提示</a>
                    {/if}
                {else /}
                <a href="javascript:;" onclick="add_suspended({$vo.id},'suspend_order')" class="label label-warning radius" title="分配中止订单提示">分配中止订单提示</a>
                {/if}
                {if $info['refuse_order']}
                    {if (in_array($vo['id'],$info['refuse_order']))}
                        <a href="javascript:;" onclick="cancel_refuse({$vo.id},'refuse_order ')" class="label label-warning radius" title="取消拒绝订单提示">取消拒绝订单提示</a>
                    {else /}
                        <a href="javascript:;" onclick="add_refuse({$vo.id},'refuse_order ')" class="label label-warning radius" title="分配取消订单提示">分配取消订单提示</a>
                    {/if}
                {else /}
                    <a href="javascript:;" onclick="add_refuse({$vo.id},'refuse_order ')" class="label label-warning radius" title="分配取消订单提示">分配取消订单提示</a>
                {/if}
                {if $info['leave_message']}
                {if (in_array($vo['id'],$info['leave_message']))}
                <a href="javascript:;" onclick="cancel_leave_message({$vo.id},'leave_message')" class="label label-warning radius" title="取消请假消息提示">取消请假消息提示</a>
                {else /}
                <a href="javascript:;" onclick="add_leave_message({$vo.id},'leave_message')" class="label label-warning radius" title="请假消息提示">请假消息提示</a>
                {/if}
                {else /}
                <a href="javascript:;" onclick="add_leave_message({$vo.id},'leave_message')" class="label label-warning radius" title="请假消息提示">请假消息提示</a>
                {/if}
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <div class="page-bootstrap">{$page}</div>
</div>
{/block}
{block name="script"}
<script>
    function add_suspended(id,val) {
        $.ajax({
            url: '/admin/admin_role/add_suspended',
            type: 'get',
            data: { 'id': id, 'type': val},
            success: function (res) {
                if (res.msg) {
                    layer.msg(res.msg,{
                        time: 2000
                    })
                    location.reload()
                }else{
                    layer_open('司机接受','/admin/pub/role/id/1')
                }
            }
        });
    }
    // 添加请假消息的提示
    function add_leave_message(id,val) {
        $.ajax({
            url: '/admin/admin_role/add_leave_message',
            type: 'get',
            data: { 'id': id, 'type': val},
            success: function (res) {
                if (res.msg) {
                    layer.msg(res.msg,{
                        time: 2000
                    })
                    location.reload()
                }else{
                    layer_open('司机接受','/admin/pub/role/id/1')
                }
            }
        });
    }

    //取消请假消息
    function cancel_leave_message(id,val) {
        $.ajax({
            url: '/admin/admin_role/cancel_leave_message',
            type: 'get',
            data: { 'id': id, 'type': val},
            success: function (res) {
                if (res.msg) {
                    layer.msg(res.msg,{
                        time: 2000
                    })
                    location.reload()
                }else{
                    layer_open('司机接受','/admin/pub/role/id/1')
                }
            }
        });
    }

    //取消中止订单
    function cancel_suspended(id,val) {
        $.ajax({
            url: '/admin/admin_role/cancel_suspended',
            type: 'get',
            data: { 'id': id, 'type': val},
            success: function (res) {
                if (res.msg) {
                    layer.msg(res.msg,{
                        time: 2000
                    })
                    location.reload()
                }else{
                    layer_open('司机接受','/admin/pub/role/id/1')
                }
            }
        });
    }
    //添加拒绝
    function add_refuse(id,val) {
        $.ajax({
            url: '/admin/admin_role/add_refuse',
            type: 'get',
            data: { 'id': id, 'type': val},
            success: function (res) {
                if (res.msg) {
                    layer.msg(res.msg,{
                        time: 2000
                    })
                    location.reload()
                }else{
                    layer_open('司机接受','/admin/pub/role/id/1')
                }
            }
        });
    }
    //取消拒绝订单
    function cancel_refuse(id,val) {
        $.ajax({
            url: '/admin/admin_role/cancel_refuse',
            type: 'get',
            data: { 'id': id, 'type': val},
            success: function (res) {
                if (res.msg) {
                    layer.msg(res.msg,{
                        time: 2000
                    })
                    location.reload()
                }else{
                    layer_open('司机接受','/admin/pub/role/id/1')
                }
            }
        });
    }
</script>
{/block}